/*
 * tilelayer_test.cpp
 *
 *  Created on: 10/11/2011
 *      Author: Tales
 */

#include "TileLayerApp.hpp"
#include "framework/Scene2d.hpp"
#include "video/Texture.hpp"
#include "video/Tileset.hpp"
#include "engine/TileLayer.hpp"

namespace yep
{

TileLayerTest TileLayerTest::_instance;

TileLayerTest::TileLayerTest() :
		Application("tileset/TileLayer Test", "Tests the TileLayer class")
{
	_scene = NULL;
}

Scene & TileLayerTest::getFirstScene()
{
	if (!_scene)
	{
		_scene = new Scene2d;
		_tilesetTexture = new Texture("res/tilesets/tileset.png");
		_tileset = new Tileset(*_tilesetTexture, 32, 32);
		TileLayer * tilemap = new TileLayer(
				{1, 1, 1, 1, 1,
				 1, 1, 2, 3, 1,
				 4, 8, 5, 6, 4,
				 7, 4, 8, 9, 7,
				 8, 7, 8, 9, 8});
		tilemap->setMapHeight(5);
		tilemap->setMapWidth(5);
		tilemap->setTileset(*_tileset);
		_scene->add(*tilemap);
	}
	return *_scene;
}

TileLayerTest::~TileLayerTest()
{
}

} /* namespace yep */
